//
//  ShenQingJiaRuCell.m
//  YaoHeAPP
//
//  Created by xyh on 16/7/6.
//  Copyright © 2016年 mac. All rights reserved.
//

#import "ShenQingJiaRuCell.h"
#import "ShenQingJiaRuItemModel.h"
#import "UIImageView+WebCache.h"
@interface ShenQingJiaRuCell ()
@property (nonatomic,strong) UIImageView *headImg;
@property (nonatomic,strong) UILabel *peopleName;
@property (nonatomic,strong) UILabel     *iphoneNum;
@end

@implementation ShenQingJiaRuCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        //头像
        _headImg=[[UIImageView alloc]init];
        _headImg.frame=CGRectMake(15, 10, 50, 50);
        _headImg.layer.masksToBounds=YES;
        _headImg.layer.cornerRadius=25;
        _headImg.tag=10;
        [self addSubview:_headImg];
        
        //人名
        _peopleName=[[UILabel alloc]init];
        _peopleName.frame=CGRectMake(70, 10, 200, 20);
        _peopleName.font=font14;
        _peopleName.text=@"小明";
        _peopleName.textColor=[UIColor colorWithRed:102.f/255.f green:102.f/255.f blue:115.f/255.f alpha:1];
        _peopleName.tag=11;
        [self addSubview:_peopleName];
        
        //手机图片
        UIImageView *iponv=[[UIImageView alloc]init];
        iponv.image=[UIImage imageNamed:@"iphone"];
        iponv.frame=CGRectMake(70, 40, 14, 20);
        [self addSubview:iponv];
        //电话号码
        _iphoneNum=[[UILabel alloc]init];
        _iphoneNum.textColor=[UIColor colorWithRed:102.f/255.f green:102.f/255.f blue:115.f/255.f alpha:1];
        _iphoneNum.font=font12;
        _iphoneNum.text=@"15890012208";
        _iphoneNum.tag=13;
        _iphoneNum.frame=CGRectMake(70+20, 40, 200, 20);
        [self addSubview:_iphoneNum];

        // 同意按钮
        UIButton *tongyiButton = [UIButton buttonWithType:UIButtonTypeCustom];
        [tongyiButton setTitle:@"同意" forState:UIControlStateNormal];
        tongyiButton.frame=CGRectMake(SCREEN_WIDTH-90, 20, 70, 30);
        tongyiButton.titleLabel.font=Font(14);
        tongyiButton.backgroundColor=RGBCOLOR(20, 160, 245);
        [tongyiButton addTarget:self action:@selector(tongyiButtonClick) forControlEvents:UIControlEventTouchUpInside];
        [self addSubview:tongyiButton];
        
        
        UIView *fenjiexian = [[UIView alloc]initWithFrame:CGRectMake(0, 69.5, SCREEN_WIDTH, 0.5)];
        fenjiexian.backgroundColor = [UIColor colorWithRed:230/255.0 green:232/255.0 blue:241/255.0  alpha:1];
        [self.contentView addSubview:fenjiexian];
    }
    return self;
}


-(void)setShenQingJiaRuItemModel:(ShenQingJiaRuItemModel *)shenQingJiaRuItemModel
{
    [_headImg sd_setImageWithURL:[NSURL URLWithString:shenQingJiaRuItemModel.LOGO_PATH] placeholderImage:[UIImage imageNamed:@"default_head"]];
    _peopleName.text=shenQingJiaRuItemModel.REG_NAME;
    _iphoneNum.text=shenQingJiaRuItemModel.REG_MOBILE;
}


- (void)tongyiButtonClick{
    if (self.shenQingJiaRuCellBlock) {
        self.shenQingJiaRuCellBlock();
    }

}


@end
